const { lchmodSync } = require("fs");
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
  mode: "development",
  entry: "./src/main.js",
  output: {
    filename: "bundle.js",
    path: path.resolve(__dirname, "./build"),
  },
  module: {
    rules: [
      // {
      //   test: /\.js$/i,
      //   use: {
      //     loader: "lyc-loader01",
      //     options: {
      //       name: "lyc",
      //       age: "23",
      //     },
      //   },
      //   enforce: "pre", // per post
      // },
      // {
      //   test: /\.js$/i,
      //   use: "lyc-loader02",
      // },
      {
        test: /\.js$/i,
        use: {
          loader: "lyc-babel-loader",
          options: {
            presets: ["@babel/preset-env"],
          },
        },
      },
      {
        test: /\.md$/i,
        use: "lyc-md-loader",
        // use: ["html-loader", "lyc-md-loader"],
      },
      {
        test: /\.css$/i,
        use: ["style-loader", "css-loader"],
      },
    ],
  },
  resolveLoader: {
    modules: ["node_modules", "./loaders"],
  },
  plugins: [new HtmlWebpackPlugin()],
};
